﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClassLibrary.Entity;

public partial class UserControl_ucLoginStatus : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
       // hypAccount.Text =(((TblCustomers)Session [Global.SESSION_LOGGED_USER]).CustomerFirstname);
        if (Session[Global.SESSION_LOGGED_USER] != "" &&
                   Session[Global.SESSION_LOGGED_USER] != null)
        {
            lnkLogin.Visible = lnkLogin.Visible = false;
            lnkLogout.Visible = true;

            TblCustomers user = (TblCustomers)Session[Global.SESSION_LOGGED_USER];

            hypAccount.Text = user.CustomerFirstname + " " + user.CustomerLastname;
            hypAccount.NavigateUrl = "~/Default4.aspx";
        }
        else
        {
            lnkLogin.Visible = lnkLogin.Visible = true;
            lnkLogout.Visible = false;
            hypAccount.Text = "";
        }
    }
    protected void lnkLogout_Click(object sender, EventArgs e)
    {
        Session.RemoveAll();
        Session.Abandon();
        Response.Redirect("Default.aspx", true);
    }
}
